package com.dragon.repository.domain.dto;

import com.dragon.repository.entity.OtherFile;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OtherFileDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "流程状态")
    private Integer streamType;

    @ApiModelProperty(value = "关联主表id")
    private Integer correlationId;

    @ApiModelProperty(value = "文件类型1图片2文件")
    private Integer fileType;

    @ApiModelProperty(value = "路径")
    private String url;

    @ApiModelProperty(value = "文件名称")
    private String fileName;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;


    public OtherFileDTO() {}

    public OtherFileDTO(OtherFile entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static OtherFileDTO convert(OtherFile entity) {
        return new OtherFileDTO(entity);
    }

    public static List<OtherFileDTO> convertList(List<OtherFile> list) {
        List<OtherFileDTO> resultList = new ArrayList<>();
        for (OtherFile entity : list) {
            resultList.add(new OtherFileDTO(entity));
        }
        return resultList;
    }}
